﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="MyModeler.FreeDrawingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyModeler"
    xmlns:common="using:MyModeler.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <UserControl.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </UserControl.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}" Text="Free Drawing"/>
        </Grid>
        <Canvas x:Name="canvas1" HorizontalAlignment="Left" Height="362" Margin="354,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="734" ScrollViewer.VerticalScrollBarVisibility="Auto" MaxWidth="20000" ScrollViewer.HorizontalScrollBarVisibility="Visible">
            <Canvas.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Canvas.Background>
        </Canvas>
        <TextBox x:Name="txtDebug" HorizontalAlignment="Left" Height="155" Margin="10,434,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Debugging Informations:" VerticalAlignment="Top" Width="1313" AcceptsReturn="True" FontFamily="Tunga" RenderTransformOrigin="0.5,0.5">
            <TextBox.RenderTransform>
                <CompositeTransform SkewY="-0.392" TranslateY="-4.493"/>
            </TextBox.RenderTransform>
        </TextBox>
        <ListView x:Name="lstTools" HorizontalAlignment="Left" Height="362" Margin="25,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="282" Padding="25,0,0,0"/>
        <Button x:Name="btnAdd" Content="Add..." HorizontalAlignment="Left" Height="39" Margin="25,377,0,0" Grid.Row="1" VerticalAlignment="Top" Width="105" Click="btnAdd_Click"/>
        <Button x:Name="btnClear" Content="Clear" HorizontalAlignment="Left" Height="39" Margin="135,377,0,0" Grid.Row="1" VerticalAlignment="Top" Width="105" Click="btnClear_Click"/>
        <Button x:Name="btnProperties" Content="Properties" HorizontalAlignment="Left" Margin="1234,341,0,0" Grid.Row="1" VerticalAlignment="Top" Width="104" Click="btnProperties_Click"/>
        <TextBlock HorizontalAlignment="Left" Height="16" Margin="1115,23,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Properties:" VerticalAlignment="Top" Width="72"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,83,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Name:" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,113,0,0" Grid.Row="1" TextWrapping="Wrap" Text="ID:" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,143,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Type:" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,173,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Text:" VerticalAlignment="Top"/>
        <TextBox x:Name="txtName" HorizontalAlignment="Left" Margin="1192,71,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10"/>
        <TextBox x:Name="txtObjectId" HorizontalAlignment="Left" Margin="1192,101,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10" MaxHeight="25"/>
        <TextBox x:Name="txtType" HorizontalAlignment="Left" Margin="1192,131,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10"/>
        <TextBox x:Name="txtText" HorizontalAlignment="Left" Margin="1191,161,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,233,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Fill Color:" VerticalAlignment="Top"/>
        <TextBox x:Name="txtFillColor" HorizontalAlignment="Left" Margin="1192,221,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,263,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Line Color:" VerticalAlignment="Top"/>
        <TextBox x:Name="txtLineColor" HorizontalAlignment="Left" Margin="1192,251,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10"/>
        <CheckBox x:Name="chkHasFillColor" Content="Has Fill Color" HorizontalAlignment="Left" Margin="1128,281,0,0" Grid.Row="1" VerticalAlignment="Top" FontSize="11" MinHeight="25"/>
        <CheckBox x:Name="chkHasLineColor" Content="Has Line Color" HorizontalAlignment="Left" Margin="1128,311,0,0" Grid.Row="1" VerticalAlignment="Top" FontSize="11" MinHeight="25"/>
        <CheckBox x:Name="chkIsSolidFillColor" Content="Is Solid Fill Color" HorizontalAlignment="Left" Margin="1234,281,0,0" Grid.Row="1" VerticalAlignment="Top" FontSize="11" MinHeight="25"/>
        <TextBox x:Name="txtPosition" HorizontalAlignment="Left" Margin="1192,41,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10" MaxHeight="25"/>
        <TextBlock HorizontalAlignment="Left" Margin="1128,53,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Position:" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Margin="1129,203,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Image:" VerticalAlignment="Top"/>
        <TextBox x:Name="txtImage" HorizontalAlignment="Left" Margin="1192,191,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="10" Width="152" MinHeight="10"/>
        <Button x:Name="btnUpdateProperties" Content="Update..." HorizontalAlignment="Left" Margin="1128,341,0,0" Grid.Row="1" VerticalAlignment="Top" Width="101" Click="btnUpdateProperties_Click"/>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup>
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
